package cn.com.aiouyi.exception.business;

import cn.com.aiouyi.common.ExceptionCode;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;

/**
 * Created by tommy on 2018/3/27.
 * 通用的业务异常。只做提示用，不记录数据库
 */
@Getter
@Setter
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    
    /** 额外数据，需要时可加上  */
    protected JSONObject data;
    
    /** 异常代码 */
    protected ExceptionCode exceptionCode;
    
    public BusinessException(ExceptionCode exceptionCode) {
        super(exceptionCode.toString());
        this.exceptionCode = exceptionCode;
    }
    
    public BusinessException(String message, Throwable throwable) {
        super(message, throwable);  
    }  
  
    public BusinessException(String message) {
        super(message);  
    }  
  
    public BusinessException(Throwable throwable) {
        super(throwable);  
    }
}
